package org.big.rocktproducer.medium;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageServiceMedium {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    // 发送简单消息（到simple-topic）
    public void sendMessage(String message) {
        rocketMQTemplate.convertAndSend("simple-topic", message);
        System.out.println("Sent message: " + message);
    }

    // 发送订单消息（到order-topic）
    public void sendOrderMessage(Order orderInfo) {
        rocketMQTemplate.convertAndSend("order-topic", orderInfo);
        System.out.println("Sent order message: " + orderInfo);
    }
}